setClass("NormNoiseRowBootstrapedSet",contains="vRowBootstrapedSet",
		representation(
			.colSdevs="numeric",
			.percentOfSdev="numeric"
		),
		prototype=prototype(
				.colSdevs=numeric(0),
				.percentOfSdev=0.001,
				.description="Normal Noise Row bootstrap Class "
		),
		validity=function(.Object){
			if( (.Object@.percentOfSdev <=0 )| (.Object@.percentOfSdev >1) ){
				stop("percentOfSdev must be in (0;1]")
			}
			if( .Object@.percentOfSdev >=0.20){
				warning("percent of variance is high")
				
			}
		}

) 

##methods


setMethod("initialize",
		signature="NormNoiseRowBootstrapedSet",
		function(.Object,inputSet,bSamplesNumber,percentOfSdev=0.001,...){
			.Object <-callNextMethod(.Object,inputSet,bSamplesNumber,...);
			.Object@.percentOfSdev <-  percentOfSdev
			.Object@.colSdevs <- ( unlist( lapply(1:( dim(.Object@.originalSet$X)[2] ),FUN=function(n,set){
											sd(set[,n])
										},
										.Object@.originalSet$X ) ) )*percentOfSdev
			
			validObject(.Object)			
			return(.Object)
		})
setMethod("changeSet",
		signature="NormNoiseRowBootstrapedSet",
		definition=function(.Object,inputSet,...){
			.Object<-initialize(.Object,inputSet=inputSet,bSamplesNumber=.Object@.bSamplesNumber,percentOfSdev=.Object@.percentOfSdev,...)
			
			
			return(.Object)
		})

setMethod("getAt",
		signature="NormNoiseRowBootstrapedSet",
		definition=function(.Object,position,...){
			.Object@.currentSet <-callNextMethod(.Object,position,...);
			
			setDims <- dim(.Object@.originalSet$X)
			
			noiseMatrix <- matrix( rnorm( setDims[1]*setDims[2], sd=.Object@.colSdevs ), ncol=setDims[2],byrow=TRUE )
			.Object@.currentSet$X <- .Object@.currentSet$X + noiseMatrix
			
			return(.Object@.currentSet)
			
		})

 
